<template>
  <div>
      <div v-for="i in user_list" :key="i.id">
          <h4>用户名：{{i.username}}</h4>
          <!-- <h4>密码：{{i.password}}</h4> -->
          <h4>权限认证：{{i.authority}}（超级权限1，普通权限2）</h4>
          <h4>部门：{{i.cate}}</h4>
      </div>
      <div>
          <input type="button" @click="btn(cur_num-1)" value="上一页">
          <input type="button" v-for="num in user_lsit1" :key="num" @click="btn(num)" :value="num" style="margin:0px 10px">
          <input type="button" @click="btn(cur_num+1)" value="下一页">
          
      </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            user_list:[],
            user_lsit1:[],
            cur_num:1
        }
    },created(){
        // axios.get('http://127.0.0.1:8000/login').then(resp=>{
        //     console.log(resp.data)
        //     this.user_list=resp.data.data
        //     this.user_lsit1=resp.data.user_list
        // }).catch(error=>{
        //     console.log(error)
        // })
        this.btn(1)
    },methods:{
        btn(num){
            this.cur_num=num
          axios.get('http://127.0.0.1:8000/login?num='+num).then(resp=>{
            console.log(resp.data)
            this.user_list=resp.data.data
            this.user_lsit1=resp.data.user_list
        }).catch(error=>{
            console.log(error)
        })  
        }
    }
}
</script>

<style>

</style>